package com.office.supplies.controller;

import com.github.pagehelper.PageInfo;
import com.office.supplies.pojo.Result;
import com.office.supplies.pojo.dto.SelectStockDTO;
import com.office.supplies.pojo.vo.SelectStockVO;
import com.office.supplies.service.StockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author admin
 * @Description 库存相关接口
 * @Date 2023/12/11/23:28
 */
@RestController
@Slf4j
@RequestMapping("/stock")
public class StockController {

    @Autowired
    private StockService stockService;

    /**
     * 查询库存
     *
     * @param pageNum Integer
     * @param pageSize Integer
     * @param selectStockDTO SelectStockDTO
     * @return Result<PageInfo<SelectStockVO>>
     */
    @PostMapping("/list/{pageNum}/{pageSize}")
    public Result<PageInfo<SelectStockVO>> getGoodsList(@PathVariable("pageNum") Integer pageNum,
                                                        @PathVariable("pageSize") Integer pageSize,
                                                        @RequestBody SelectStockDTO selectStockDTO){
        log.info("查询库存：{}，{}，{}",pageNum,pageSize,selectStockDTO);
        return Result.success(stockService.getStockList(pageNum,pageSize,selectStockDTO));
    }

}
